In [1]:
%run ../../common.ipynb
from skimage import filter
In [2]:
image = imread('../mp.tif')
threshold_mask = filter.threshold_adaptive(image, 5)
image[np.invert(threshold_mask)] = 0
pngsave('mp_adaptive_threshold_gauss_5.png', 255-image)
from IPython.display import Image
Image('mp_adaptive_threshold_gauss_5.png')
Out[2]:
Lets try a bigger mask
In [3]:
image = imread('../mp.tif')
threshold_mask = filter.threshold_adaptive(image, 10)
image[np.invert(threshold_mask)] = 0
pngsave('mp_adaptive_threshold_gauss_10.png', 255-image)
from IPython.display import Image
Image('mp_adaptive_threshold_gauss_10.png')
Out[3]:
And a smaller one
In [4]:
image = imread('../mp.tif')
threshold_mask = filter.threshold_adaptive(image, 3)
image[np.invert(threshold_mask)] = 0
pngsave('mp_adaptive_threshold_gauss_3.png', 255-image)
from IPython.display import Image
Image('mp_adaptive_threshold_gauss_3.png')
Out[4]: